from selenium import webdriver
import pytest,logging
from Page.page2 import Page2
from Tools.Tools import read_yaml
data = read_yaml('./data.yaml')

@pytest.fixture
def driver():
    logging.info('start')
    driver = webdriver.Edge()
    yield driver
    driver.quit()
    logging.info('stop')
@pytest.mark.parametrize('datas',data)
def test_jiuxian1(driver,datas):
    po = Page2(driver)
    po.open_url('https://www.jiuxian.com/')
    po.srk_loc(datas.get('data'))
    po.srk_loc1()
    po.window_scrollTo(100)
    print(po.dy3_loc())
    dy3 = po.dy3_loc()
    assert dy3 in datas.get('dy')
    print(po.dy4_loc())
    dy4 = po.dy4_loc()
    assert dy4 == datas.get('dy2')
    po.shop_loc()
    po.window_handles()
    print(po.dy5_loc())
    dy5 = po.dy5_loc()
    assert dy5 in datas.get('dy3')
    po.addbuy_loc()
    po.select_loc()
